<template>
  <div class="practice-container">
    <Breadcrumb />
    <div class="content">
      <FinishPractice :task-info="taskInfo" />
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { useRoute } from 'vue-router'
import Breadcrumb from '@/components/Breadcrumb.vue'
import FinishPractice from '../components/FinishPractice.vue'

const route = useRoute()

const taskInfo = ref({
  taskId: null,
  classList: [],
  taskType: null,
  fileList: [],
  name: ''
})

const initData = () => {
  taskInfo.value = {
    taskId: route.query?.taskId,
    classList: JSON.parse(route.query?.classList).map(item => ({
      value: item.class_id,
      label: item.class_name
    })),
    taskType: Number(route.query?.taskType),
    fileList: JSON.parse(route.query?.fileList),
    name: route.query?.name
  }
}
initData()
</script>
<style lang="less" scoped>
.practice-container {
  .content {
    background-color: #fff;
    margin-top: 20px;
  }
}
</style>
